From bc8e3322c57414d78036f9837ec03183e96845a3 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 8 Apr 2016 13:30:45 -0700 Subject: [PATCH] Make a test a bit more robust to the environment Don't filter out PATH as `rustc` may be in that directory (e.g. when using rustup) and otherwise just have a longer subcommand. Closes #2553 --- tests/test_cargo.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/tests/test_cargo.rs b/tests/test_cargo.rs index 7b5b63612..35241ac64 100644 --- a/tests/test_cargo.rs +++ b/tests/test_cargo.rs @@ -71,16 +71,9 @@ error = ERROR))); // if a subcommand is more than 3 edit distance away, we don't make a suggestion test!(find_closest_dont_correct_nonsense { - let paths = path().into_iter().filter(|p| { - fs::read_dir(p).into_iter() - .flat_map(|i| i) - .filter_map(|e| e.ok()) - .all(|e| !e.file_name().to_str().unwrap_or("").starts_with("cargo-")) - }); let mut pr = cargo_process(); - pr.arg("asdf") - .cwd(&paths::root()) - .env("PATH", env::join_paths(paths).unwrap()); + pr.arg("there-is-no-way-that-there-is-a-command-close-to-this") + .cwd(&paths::root()); assert_that(pr, execs().with_status(101) -- 2.30.2